package com.zhangkun.springboot.controller;

import com.zhangkun.springboot.entity.Student;
import com.zhangkun.springboot.service.StudentService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author: zhangkun
 * @date: 2017/7/4 14:55
 * @description:
 */
@RestController
@RequestMapping("/student")
public class StudentController {

    private static final Logger logger = LoggerFactory.getLogger(StudentController.class);

    @Autowired
    private StudentService studentService;

    @RequestMapping("/list")
    public List<Student> getStus() {
        logger.info("load from db");
        List<Student> list = studentService.getList();
        logger.info("get info:{}", list);
        return list;
    }
}
